]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
shell-tray-icon: Use available space when that's defined
authorMarco Trevisan (Treviño) <mail@3v1n0.net>
Wed, 1 May 2024 02:18:50 +0000 (04:18 +0200)
committerSimon McVittie <smcv@debian.org>
Sun, 13 Jul 2025 11:24:58 +0000 (12:24 +0100)
Origin: https://gitlab.gnome.org/3v1n0/gnome-shell/-/commits/tray-offscreen-xwindows
Bug: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7613
Bug-Ubuntu: https://bugs.launchpad.net/bugs/2012388

Gbp-Pq: Topic tray-icons
Gbp-Pq: Name shell-tray-icon-Use-available-space-when-that-s-defined.patch

src/shell-tray-icon.c
src/tray/na-xembed.c
src/tray/na-xembed.h

index 462945e9e6e3bc94616355694dc7fca284f740b9..39204bfe66f9f693db561248a0586d80c80f6d0b 100644 (file)
@@ -185,6 +185,10 @@ shell_tray_icon_allocate (ClutterActor          *actor,
 
   CLUTTER_ACTOR_CLASS (shell_tray_icon_parent_class)->allocate (actor, box);
 
+  na_xembed_set_available_size (NA_XEMBED (tray_icon->tray_child),
+                                roundf (clutter_actor_box_get_width (box)),
+                                roundf (clutter_actor_box_get_height (box)));
+
   /* Find the actor's new coordinates in terms of the stage.
    */
   clutter_actor_get_transformed_position (actor, &wx, &wy);
index 1be1e9dd295fc203b13839b19dad2a0e55988351..d4c389cc76ebf9af8734e579a4905ca711e4ae6d 100644 (file)
@@ -43,6 +43,8 @@ struct _NaXembedPrivate
   int request_height;
   int current_width;
   int current_height;
+  int available_width;
+  int available_height;
   int resize_count;
   int xembed_version;
 
@@ -141,6 +143,8 @@ na_xembed_end_embedding (NaXembed *xembed)
   priv->current_width = 0;
   priv->current_height = 0;
   priv->resize_count = 0;
+  priv->available_width = -1;
+  priv->available_height = -1;
   g_clear_handle_id (&priv->resize_id, g_source_remove);
 }
 
@@ -186,6 +190,11 @@ na_xembed_synchronize_size (NaXembed *xembed)
   width = priv->request_width;
   height = priv->request_height;
 
+  if (priv->available_width >= 0)
+    width = priv->available_width;
+  if (priv->available_height >= 0)
+    height = priv->available_height;
+
   XMoveResizeWindow (xdisplay,
                      priv->socket_window,
                      x, y,
@@ -745,6 +754,10 @@ na_xembed_class_init (NaXembedClass *klass)
 static void
 na_xembed_init (NaXembed *xembed)
 {
+  NaXembedPrivate *priv = na_xembed_get_instance_private (xembed);
+
+  priv->available_width = -1;
+  priv->available_height = -1;
 }
 
 void
@@ -809,6 +822,22 @@ na_xembed_get_size (NaXembed *xembed,
     *height = priv->request_height;
 }
 
+void
+na_xembed_set_available_size (NaXembed *xembed,
+                              int       width,
+                              int       height)
+{
+  NaXembedPrivate *priv = na_xembed_get_instance_private (xembed);
+
+  if (priv->available_width == width && priv->available_height == height)
+    return;
+
+  priv->available_width = width;
+  priv->available_height = height;
+
+  na_xembed_resize (xembed);
+}
+
 void
 na_xembed_get_root_position (NaXembed *xembed,
                              int      *x,
index 4466305aa5618694856dd0ef37d5337e005eeca0..271060d8348179c0e94202f7319d5d08d1a3ee36 100644 (file)
@@ -58,6 +58,10 @@ void na_xembed_get_size (NaXembed *xembed,
                         int      *width,
                         int      *height);
 
+void na_xembed_set_available_size (NaXembed *xembed,
+                                  int       width,
+                                  int       height);
+
 void na_xembed_set_background_color (NaXembed        *xembed,
                                      const CoglColor *color);